import { dayjs, cloneDeep, getRandomIntBetween } from "./utils";
import { UserFilled, HelpFilled, CircleCheck, StarFilled } from "@element-plus/icons-vue";


const days = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"];

/** 需求人数、提问数量、解决数量、用户满意度 */
const chartData = [
  {
    icon: UserFilled, // 替换为 Element Plus 图标组件
    bgColor: "#effaff",
    color: "#41b6ff",
    duration: 3000,
    name: "安全检查记录数量",
    value: 3600,
    percent: "+88%",
    data: [210, 528, 423, 496, 675, 520, 745] // 平滑折线图数据
  },
  {
    icon: HelpFilled, // 替换为 Element Plus 图标组件
    bgColor: "#fff5f4",
    color: "#e85f33",
    duration: 3000,
    name: "安全隐患信息数量",
    value: 165,
    percent: "+70%",
    data: [2216, 1148, 1255, 788, 4821, 1973, 4379]
  },
  {
    icon: CircleCheck, // 替换为 Element Plus 图标组件
    bgColor: "#eff8f4",
    color: "#26ce83",
    duration: 3000,
    name: "问题整改数量",
    value: 124,
    percent: "+99%",
    data: [861, 1002, 3195, 1715, 3666, 2415, 3645]
  },

  {
    icon: StarFilled, // 替换为 Element Plus 图标组件
    bgColor: "#f6f4fe",
    color: "#7846e5",
    duration: 3000,
    name: "安全隐患整改率",
    value: 100,
    percent: "+100%",
    data: [100]
  }
];

/** 分析概览 */
const barChartData = [
  {
    requireData: [210, 528, 423, 492, 652, 528, 740],
    questionData: [221, 114, 125, 178, 481, 193, 439]
  },
  {
    requireData: [211, 320, 440, 496, 575, 688, 760],
    questionData: [211, 318, 325, 378, 482, 490, 539]
  }
];

/** 检查计划概率 */
const progressData = [
  {
    week: "周一",
    percentage: 85,
    duration: 3000,
    color: "#41b6ff"
  },
  {
    week: "周二",
    percentage: 86,
    duration: 3000,
    color: "#41b6ff"
  },
  {
    week: "周三",
    percentage: 88,
    duration: 3000,
    color: "#41b6ff"
  },
  {
    week: "周四",
    percentage: 89,
    duration: 3000,
    color: "#41b6ff"
  },
  {
    week: "周五",
    percentage: 94,
    duration: 3000,
    color: "#26ce83"
  },
  {
    week: "周六",
    percentage: 96,
    duration: 3000,
    color: "#26ce83"
  },
  {
    week: "周日",
    percentage: 100,
    duration: 3000,
    color: "#26ce83"
  }
].reverse();

/** 数据统计 */
const tableData = Array.from({ length: 30 }).map((_, index) => {
  return {
    id: index + 1,
    requiredNumber: getRandomIntBetween(1350, 1999),
    questionNumber: getRandomIntBetween(1260, 1699),
    resolveNumber: getRandomIntBetween(1350, 1799),
    satisfaction: getRandomIntBetween(95, 100),
    date: dayjs().subtract(index, "day").format("YYYY-MM-DD")
  };
});

/** 最新动态 */
const latestNewsData = cloneDeep(tableData)
  .slice(0, 14)
  .map((item, index) => {
    return Object.assign(item, {
      date: `${dayjs().subtract(index, "day").format("YYYY-MM-DD")} ${
        days[dayjs().subtract(index, "day").day()]
      }`
    });
  });

export { chartData, barChartData, progressData, tableData, latestNewsData };
